package com.hyx.bookManager.controller;

import com.hyx.bookManager.domain.common.CommonResult;
import com.hyx.bookManager.service.TagService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @ClassName TagController
 * @Description TODO
 * @Author 黄乙轩
 * @Date 2021/6/18 21:26
 * @Version 1.0
 **/

@CrossOrigin
@RestController
@RequestMapping("tag")
public class TagController {

    @Autowired
    private TagService tagService;

    @GetMapping("/getAllTag")
    public CommonResult getAllTag(){
        return tagService.getAllTag();
    }

    @ResponseBody
    @RequestMapping("/insertTag")
    public CommonResult insertTag(@RequestBody Map<String,String> map){
        String tagName = map.get("tagName");
        return tagService.insertTag(tagName);
    }
}
